﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FormUseWebservice
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            InnerService.LoginWebServiceSoapClient serv = new InnerService.LoginWebServiceSoapClient();
            
            InnerService.LoginWebServiceSoapClient service = new InnerService.LoginWebServiceSoapClient();
            string result = service.Login1("fjoisdkfjskfsjfdsfsdlfdlkjfslfsd");
            MessageBox.Show(result);
        }

        /// <summary>
        /// 接口参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin2_Click(object sender, EventArgs e)
        {
            InnerService.LoginWebServiceSoapClient service = new InnerService.LoginWebServiceSoapClient();
            InnerService.ReturnBase returnObj = service.Login2(txtUserName.Text, txtPwd.Text, "fjoisdkfjskfsjfdsfsdlfdlkjfslfsd");
            MessageBox.Show(JsonConvert.SerializeObject(returnObj));
        }

        /// <summary>
        /// 动态参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin3_Click(object sender, EventArgs e)
        {
            InnerService.LoginWebServiceSoapClient service = new InnerService.LoginWebServiceSoapClient();
            //参数对象
            InnerService.ParamBase paramObj = new InnerService.ParamBase()
            {
                ParamJson = "{\"Id\":1,\"Name\":\"刘备\",\"Age\":\"22\"}",
                Secret = "$%^SsJKd",
                Token = "fjoisdkfjskfsjfdsfsdlfdlkjfslfsd"
            };
            InnerService.ReturnBase returnObj = service.Login3(paramObj);
            MessageBox.Show(JsonConvert.SerializeObject(returnObj));
        }
    }
}
